import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import Layout from '../layout/My_Index.vue'
Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path: '/',
    component: Layout, // 修改为 Layout 组件
    children: [
      {
        path: '',
        component: () => import( '../views/HomeView.vue'),
        name: 'Index'
      }
    ]
  },
  {
    path: '/User',
    component: Layout, // 修改为 Layout 组件
    children: [
      {
        path: '',
        component: () => import( '../views/User/User_Index.vue'),
        name: 'User'
      }
    ]
  },
  {
    path: '/Role',
    component: Layout, // 修改为 Layout 组件
    children: [
      {
        path: '',
        component: () => import( '../views/User/Role_Index.vue'),
        name: 'Role'
      }
    ]
  },
  {
    path: '/icon',
    component: Layout, // 修改为 Layout 组件
    children: [
      {
        path: '',
        component: () => import( '../views/User/ele_Icon.vue'),
        name: 'eleIcon'
      }
    ]
  },
  {
    path: '/Permission',
    component: Layout, // 修改为 Layout 组件
    children: [
      {
        path: '',
        component: () => import( '../views/User/Permission_Index.vue'),
        name: 'Permission'
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/User_Login.vue')
  },

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
